package com.example.androidmaze;

import java.util.Observable;

public class StateManager extends Observable{
	
	private int state;
	
	public int getState()
	{
		return state;
	}
	
	public void setState(int newState)
	{
		if (isValidState(newState))
		{
			this.state = newState;
			setChanged();
			notifyObservers();
		}
		else
		{
			throw(new IllegalArgumentException("Illegal State Passed"));
		}
	}
	
	public boolean isValidState(int state)
	{
		if ((state == Constants.STATE_FINISH || state == Constants.STATE_GENERATING || state == Constants.STATE_PLAY || state == Constants.STATE_TITLE))
		{
			return true;
		}
		else
		{
			return false;
		}
	}
}
